﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Drawing;
using System.Data;
using System.Linq;
using System.Text;
using System.Windows.Forms;

namespace GestionePolveri2.Editors
{
    public partial class TextCellEditor : UserControl
    {
        private string m_text = string.Empty;

        public string Content
        {
            get { return m_text; }
            set 
            { 
                m_text = value;

                this.textBox1.Text = m_text;
            }
        }

        public TextCellEditor()
        {
            InitializeComponent();

            this.btnOk.Click += new EventHandler(btnOk_Click);
            this.btnCancel.Click += new EventHandler(btnCancel_Click);
            this.pictureBox1.Click += new EventHandler(pictureBox1_Click);
        }

        void pictureBox1_Click(object sender, EventArgs e)
        {
            this.textBox1.Clear();
        }

        void btnCancel_Click(object sender, EventArgs e)
        {
            this.Hide();
            this.Dispose();
        }

        void btnOk_Click(object sender, EventArgs e)
        {
            m_text = this.textBox1.Text;
            this.Hide();
            this.Dispose();
        }
    }
}
